package com.tanhua.dubbo.server.config;

import com.tanhua.dubbo.server.interceptor.RedisCacheInterceptor;
import com.tanhua.dubbo.server.interceptor.UserTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with IntelliJ IDEA.
 *
 * @ClassName: WebConfig
 * @Author:王晨晗
 * @Description: webmvc配置类
 * @Date: 2021/12/29/16:38
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private RedisCacheInterceptor redisCacheInterceptor;
    @Autowired
    private UserTokenInterceptor userTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userTokenInterceptor).addPathPatterns("/**");
        registry.addInterceptor(redisCacheInterceptor).addPathPatterns("/**");
    }
}
